/*
 * @Author: your name
 * @Date: 2020-08-28 10:52:07
 * @LastEditTime: 2020-09-07 18:35:28
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /express/src/utils/util.ts
 */
interface Result<T> {
  sucesss: boolean;
  errMsg?: string;
  data: T;
}

export const getResponseData = <T>(data: T, errMsg?: string): Result<T> => {
  if (errMsg) {
    return {
      sucesss: false,
      errMsg,
      data
    };
  }
  return {
    sucesss: true,
    data
  };
};
